package com.zl.learning.db.postgresql;

import org.junit.Test;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * Created by zhaolei on 2017/6/16.
 */
public class MyTest {
    @Test
    public void test1() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        TestReflact testReflact = new TestReflact();
        Class cla = testReflact.getClass();
        Method[] methods = cla.getDeclaredMethods();
        Method method = cla.getDeclaredMethod("say",String[].class);
        method.setAccessible(true);
        String[] strs = new String[]{"Hello"};
        method.invoke(testReflact,new Object[]{strs});
        method.setAccessible(false);
    }
}
